Offload routed expert of RL - #1957
Conversation
|
@claude review |
|
Claude: ## Summary Adds ProduceBatchResult impact: not affected IssuesWarning
Nit
VerdictAPPROVE — the core logic is correct and well-scoped. The offload flag cleanly integrates with the existing |
|
@claude approve |
There was a problem hiding this comment.
LGTM. The offloading logic is clean -- skipping the .to(device) in SequenceContext.to() when the flag is set, and doing the per-layer transfer on demand in _pre_moe_forward with .contiguous() before .to() is correct. The memory logging additions are a nice bonus.
|
Claude: Approved as requested. The PR adds a clean offloading mechanism for rollout routed experts to CPU, reducing GPU memory pressure when large batches are dispatched to train workers. The implementation correctly gates the .to(device) call in SequenceContext.to() and performs per-layer on-demand transfers in _pre_moe_forward. Memory logging (max_memory, reserved_memory) was also added to WorkerTrainLogItem. |
当输入给每个 trainworker 过多的数据后,原本不起眼的 routed expert 所占显存将会变得明显。本 PR 提供通过 offload_rollout_routed_experts 配置来将 routed expert 放置于 cpu 上,当需要时候再移到 gpu 上。
当前没有实现 prefetch 功能,原因是训练耗时占比本身不高。